package com.etone.smartAudit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etone.smartAudit.domain.FieldCase;
import com.etone.smartAudit.vo.fieldCase.ContributorTopVO;
import com.etone.smartAudit.vo.fieldCase.FieldCaseDetailVO;
import com.etone.smartAudit.vo.fieldCase.FieldCaseListVO;
import com.etone.smartAudit.vo.fieldCase.FieldCaseSimpleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: sovy
 * @date: 2020/8/18
 * @description:
 */
@Mapper
public interface FieldCaseMapper extends BaseMapper<FieldCase> {
    /**
     * 查询案例列表
     *
     * @param fieldId
     * @return
     */
    List<FieldCaseListVO> findList(@Param("fieldId") Integer fieldId);

    /**
     * 案例详情
     *
     * @param id
     * @return
     */
    FieldCaseDetailVO findFieldCaseDetailVOById(@Param("id") Integer id);

    /**
     * 查看次数+number
     *
     * @param id
     * @return
     */
    int addLookCnt(@Param("id") Integer id, @Param("number") Integer number);

    /**
     * 下载次数+number
     *
     * @param id
     * @param number
     * @return
     */
    int addDownloadCnt(@Param("id") Integer id, @Param("number") Integer number);

    /**
     * 查询案例基本信息
     *
     * @param fieldId
     * @param orderBy
     * @return
     */
    List<FieldCaseSimpleVO> findListSimple(@Param("fieldId") Integer fieldId, @Param("orderBy") String orderBy);

    /**
     * 贡献人排名
     *
     * @param top
     * @return
     */
    List<ContributorTopVO> contributorTop(@Param("top") Integer top);
}
